# -*- coding: utf-8 -*-
# @Time : 2024/6/19 11:39 AM 
# @Author : Wayne
# @Email : 1
# @File : zhangxiang.py
# @Project : young_python_demo
# @DESCRIPTION :



jack_sum_goods_list = [
        {
            "identity": "12344",
            "cang_ku": 0
        },
        {
            "identity": "434343",
            "cang_ku": 330
        }
    ]
# 获取映射表下的具体字段
def mapping_vlookup(code, mapping_list, return_str, identity="identity"):
    """
    入参：
    code = "与映射表主键进行匹配"
    mapping_list = "映射表"
    return_key = "返回的字段"
    identity = "查询的键"
    返参：
    result = 具体的值，字符串或者数值格式
    """
    for item in mapping_list:
        # 入参的代码和映射表的主键做匹配
        if code == item[identity]:
            result = item.get(return_str)
            return result

jky_code = "434343"
a = mapping_vlookup(jky_code,jack_sum_goods_list,"cang_ku","identity")
print(a)